#ifndef GAME_CLIENT_H
#define GAME_CLIENT_H
#include <string>
#include <vector>
#include "game_client_player.h"
#include "game_client_room_status.h"
class GameClientHandler;
class GameClientImpl;

class GameClient
{
public:
	GameClient(const std::string& host, int port);
	virtual ~GameClient(void);
	
public:
	void login(const std::string& userName, const std::string& password, bool isGuest);
	void signUp(const std::string& userName, const std::string& password);
	void activate(const std::string& newUserName, const std::string& newPassword, const std::string& phoneNo);
	void joinRoom(int roomId);
	void sendRoomData(void* data, int len);
	void sendDeskData(void* data, int len);
	void joinDesk(int deskId, int chairId);
	void createFriendDesk();
	void joinFriendDesk(const std::string deskCode);
	void leaveDesk();
	void updateRoomStatus();
	void leaveRoom();
	void updatePlayerInfo();
	GameClientPlayer* getPlayer();
	GameClientRoomStatus* getRoomStatus();
	bool getDeskPlayers(std::vector<GameClientPlayer*>& players);

public:
	virtual void onGameClientDisconnected() {}
	virtual void onGameClientConnected() {}
	virtual void onGameClientRegister(bool isSuccess, int errorCode) {};
	virtual void onGameClientLogin(bool isSuccess) {}
	virtual void onGameClientActivate(bool isSuccess, int errorCode) {}
	virtual void onGameClientJoinRoom(bool isSuccess, int errorCode) {}
	virtual void onGameClientJoinDesk(bool isSuccess, int errorCode)  {}
	virtual void onGameClientCreateFriendDesk(bool isSuccess, int errorCode, const std::string& deskCode)  {}
	virtual void onGameClientLeaveDesk(int reason) {}
	
	virtual void onGameClientRoomMessage(void* data, int len)  {}
	virtual void onGameClientDeskMessage(void* data, int len) {}
	virtual void onGameClientOtherPlayerJoinDesk(GameClientPlayer* playerInfo) {}
	virtual void onGameClientOtherPlayerLeaveDesk(GameClientPlayer* playerInfo) {}
	virtual void onGameClientUpdateRoomStatus() {}
	virtual void onGameClientSendData(const std::string& typeName, const std::string& data) {}
	virtual void onGameClientRecvData(const std::string& typeName, const std::string& data) {}
private:
	GameClientImpl* m_impl;
};
#endif
